{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li><a href="#">收益列表</a></li>
<!--    <li   {if $type=='wait'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>wait,'status'=>1));}">营业门店</a></li>-->
<!--    <li   {if $type=='ok'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>ok,'status'=>2));}">停业门店</a></li>-->
</ul>
<br>
<div class="row ygrow">
    <div class="col-lg-12">

        <form class="form-inline" action="" method="get">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="yzzc_sun" />
            <input type="hidden" name="do" value="branch_income" />
            <input type="hidden" name="token" value="{$_W['token']}"/>
            <div class="form-group">
                <label for="keyword">订单号</label>
                <input type="text" class="form-control" name="keywords" id="keyword" value="{$keywords}" placeholder="请输入订单号">
            </div>
            <div class="form-group">
                <label for="status">状态</label>
                <select class="form-control" id="status" name="status" style="width: 150px">
                    <option value="">请选择状态</option>
                    <option value="0" {if $status === "0" } selected {/if}>进行中</option>
                    <option value="1" {if $status == 1 } selected {/if}>已完成</option>
                    <option value="2" {if $status == 2 } selected {/if}>已结算</option>
                </select>
            </div>
            <div class="form-group">
                <label for="branch_id">门店</label>
                <select class="form-control" id="branch_id" name="branch_id" style="width: 150px">
                    <option value="">请选择门店</option>
                    {loop $branch_list $index $item}
                    <option value="{$item['id']}" {if $branch_id == $item['id'] } selected {/if}>{$item['name']}</option>
                    {/loop}
                </select>
            </div>
            <div class="form-group">
                <label for="status">门店类型</label>
                <select class="form-control" id="type" name="type" style="width: 150px">
                    <option value="">请选择状态</option>
                    <option value="1" {if $type == 1 } selected {/if}>平台自营</option>
                    <option value="2" {if $type == 2 } selected {/if}>商家入驻</option>
                    <option value="3" {if $type == 3 } selected {/if}>个人商户</option>
                </select>
            </div>
            <input type="submit"  name="submit"  value="搜索" class="btn btn-default">
        </form>

        <div class="col-md-4">
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div>

<div class="main ">

    <div class="panel panel-default">
        <div class="panel-heading">
            收益列表
        </div>

        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row" id="accordion">


                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <td  class="store_td1 col-md-1">门店名称</td>
                        <td  class="col-md-1">门店类型</td>
                        <td  class="col-md-1">总金额</td>
                        <td  class="col-md-1">手续费</td>
                        <td  class="col-md-1">打款金额</td>
                        <td  class="col-md-1">开户行</td>
                        <td  class="col-md-1">开户人</td>
                        <td  class="col-md-1">卡号</td>
                        <td  class="col-md-1">状态</td>
                        <td  class="col-md-1">备注</td>
                        <td class="col-md-1">创建时间</td>
                        <td>操作</td>
                    </tr>

                    {loop $info $key $item}
                    <tbody>
                    <tr class="yg5_tr2" >
                        <td>{$item['branch_name']}</td>
                        <td>
                            {if $item['type']==1}
                            <span class="label store-blue btn">平台自营</span>
                            {elseif $item['type']==2}
                            <span class="label store-green btn">商家入驻</span>
                            {elseif $item['type']==3}
                            <span class="label store-yellow btn">个人商户</span>
                            {/if}
                        </td>
                        <td>{$item['total']}</td>
                        <td>{$item['platform_fee']}</td>
                        <td>{$item['amount']}</td>
                        <td>{$item['bank_title']}</td>
                        <td>{$item['bank_name']}</td>
                        <td>{$item['bank_number']}</td>
                        <td>
                            {if $item['status']==0}
                            <span class="label store-yellow btn">待审核</span>
                            {elseif $item['status']==1}
                            <span class="label store-blue btn">审核通过</span>
                            {elseif $item['status']==2}
                            <span class="label store-red btn">驳回</span>
                            {elseif $item['status']==3}
                            <span class="label store-green btn">财务打款</span>
                            {/if}
                        </td>
                        <td>{$item['remark']}</td>
                        <td>{$item['createtime']}</td>
                        <td>
                            {if $item['status']==0}
                            <a href="{php echo $this->createWebUrl('branch_payout', array('id' => $item['id'],'op'=>change,'status'=>1))}">
                                <span class="btn btn-md store-blue">通过</span>
                            </a>
                            <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                                <span class="btn btn-md ygyouhui2">拒绝</span>
                            </a>
                            {elseif $item['status']==1}
                            <a href="{php echo $this->createWebUrl('branch_payout', array('id' => $item['id'],'op'=>change,'status'=>3))}">
                                <span class="btn btn-md store-green">财务打款</span>
                            </a>
                            {/if}
  <!--                          <a href="{php echo $this->createWebUrl('branch_payout', array('id' => $item['id']))}" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                 </span>
                            </a>-->
                            {if $item['status']!=3}
                            <a href="javascript:;" class="storespan btn btn-xs" onclick="del({$item['id']})">
                                <span class="fa fa-trash-o"></span><span class="bianji">删除<span class="arrowdown"></span></span>
                            </a>
                            {/if}
                            <!--<a href="{php echo $this->createWebUrl('branchslist', array('id' => $item['id'],'op'=>delete) )}" class="storespan btn btn-xs" >-->
                                <!--<span class="fa fa-trash-o"></span>-->
                                <!--<span class="bianji">删除-->
                                    <!--<span class="arrowdown"></span>-->
                                <!--</span>-->
                            <!--</a>-->
                        </td>
                        <!--<td>-->
                        <!--<a class="fxiala" data-toggle="collapse" data-parent="#accordion" href="#collapse{$row['id']}">-->
                        <!--<span class="fa fa-chevron-down"></span>-->
                        <!--</a>-->
                        <!--</td>-->
                    </tr>
                    </tbody>
                    <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">拒绝备注</h4>
                                </div>
                                <form action="" method="get" >
                                    <input type="hidden" name="c" value="site" />
                                    <input type="hidden" name="a" value="entry" />
                                    <input type="hidden" name="m" value="yzzc_sun" />
                                    <input type="hidden" name="do" value="branch_payout" />
                                    <input type="hidden" name="id" value="{$item['id']}" />
                                    <input type="hidden" name="op" value="change" />
                                    <input type="hidden" name="status" value="2" />
                                    <div class="modal-body" style="font-size: 20px">
                                        <input type="text" name="remark" placeholder="拒绝理由" class="form-control"/>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <input type="submit" class="btn btn-info" name="submit" value="确定"/>
                                    </div>
                                    <input type="hidden" name="token" value="{$_W['token']}"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    {/loop}
                    {if empty($info)}
                    <tr class="yg5_tr2">
                        <td colspan="8">
                            暂无收益信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </div>

    </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-1").show();
        $("#yframe-1").addClass("wyactive");
    })
    function del(id) {
        var ret = confirm("删除之后申请金额会退回到商家余额 你确认删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=branch_payout&op=delete&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    if(res.type == 'success') {
                        location.reload();
                    }else{
                        alert('删除失败');
                    }
                }
            })
        }
    }
</script>